#!/bin/bash

EXPORT_LUA_DIR="export/lua"
EXPORT_CPP_DIR="export/cpp"

PROTO_SUFFIX=".proto"
LUA_PB_SUFFIX=".pb"

# attributes
COMBAT="combat"
COMMON="common"
PLAYER="player"
SCENE="scene"
# service
ACCOUNT_SERVICE="account_service"
COMMON_SERVICE="common_service"
SCENE_SERVICE="scene_service"
PLAYER_SERVICE="player_service"


# lua
protoc --descriptor_set_out ${EXPORT_LUA_DIR}/${COMBAT}${LUA_PB_SUFFIX} attributes/${COMBAT}${PROTO_SUFFIX}
protoc --descriptor_set_out ${EXPORT_LUA_DIR}/${COMMON}${LUA_PB_SUFFIX} attributes/${COMMON}${PROTO_SUFFIX}
protoc --descriptor_set_out ${EXPORT_LUA_DIR}/${PLAYER}${LUA_PB_SUFFIX} attributes/${PLAYER}${PROTO_SUFFIX}
protoc --descriptor_set_out ${EXPORT_LUA_DIR}/${SCENE}${LUA_PB_SUFFIX} attributes/${SCENE}${PROTO_SUFFIX}

protoc --descriptor_set_out ${EXPORT_LUA_DIR}/${ACCOUNT_SERVICE}${LUA_PB_SUFFIX} service/${ACCOUNT_SERVICE}${PROTO_SUFFIX}
protoc --descriptor_set_out ${EXPORT_LUA_DIR}/${COMMON_SERVICE}${LUA_PB_SUFFIX} service/${COMMON_SERVICE}${PROTO_SUFFIX}
protoc --descriptor_set_out ${EXPORT_LUA_DIR}/${SCENE_SERVICE}${LUA_PB_SUFFIX} service/${SCENE_SERVICE}${PROTO_SUFFIX}
protoc --descriptor_set_out ${EXPORT_LUA_DIR}/${PLAYER_SERVICE}${LUA_PB_SUFFIX} service/${PLAYER_SERVICE}${PROTO_SUFFIX}


# cpp
protoc --proto_path=. --cpp_out=./${EXPORT_CPP_DIR} attributes/${COMBAT}${PROTO_SUFFIX}
protoc --proto_path=. --cpp_out=./${EXPORT_CPP_DIR} attributes/${COMMON}${PROTO_SUFFIX}
protoc --proto_path=. --cpp_out=./${EXPORT_CPP_DIR} attributes/${PLAYER}${PROTO_SUFFIX}
protoc --proto_path=. --cpp_out=./${EXPORT_CPP_DIR} attributes/${SCENE}${PROTO_SUFFIX}

protoc --proto_path=. --cpp_out=./${EXPORT_CPP_DIR} service/${ACCOUNT_SERVICE}${PROTO_SUFFIX}
protoc --proto_path=. --cpp_out=./${EXPORT_CPP_DIR} service/${COMMON_SERVICE}${PROTO_SUFFIX}
protoc --proto_path=. --cpp_out=./${EXPORT_CPP_DIR} service/${SCENE_SERVICE}${PROTO_SUFFIX}
protoc --proto_path=. --cpp_out=./${EXPORT_CPP_DIR} service/${PLAYER_SERVICE}${PROTO_SUFFIX}
